﻿using System;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;

using CoreSharp.Keyboard.Layouts;

namespace CoreSharp.Controls
{

	public partial class KeyboardLayoutViewer : UserControl
	{
        public event Action<string> KeyInput;

        public KeyboardLayout CurrentLayout
        {
            get
            {
                return this.DataContext as KeyboardLayout;
            }
        }

		public KeyboardLayoutViewer()
		{
			// Required to initialize variables
			InitializeComponent();
		}

        private void OnKeyPressed(object content)
        {
            if (content == null)
                return;

            if (this.KeyInput == null)
                return;

            this.KeyInput(content.ToString());
        }

 		private void Button_Click(object sender, System.Windows.RoutedEventArgs e)
		{
            Button btn = (Button)sender;
            this.OnKeyPressed(btn.Content);
		}


	}
}